var envents = require("events");
var Emitter = events.EmitterEmitter;
function Dog(name,energy){
    Emitter.call(this);//实现对Emitter继承
    this.name = name;
    this.energy = energy;
}
Dog.prototype = Emitter.protootype;//实现对Emitter继承
Dog.prototype.bark = function(){
    if(this.enery!=0){
        console.log(this.name+ " barked!");
        console.log("energy:"+this.energy);
        this.energy=this.energy-1;
    }
    
}
module.exports = Dog;//对外公布Dog构造函数 